package com.zl.service.impl;

import com.zl.mapper.UserMapper;
import com.zl.model.UserDto;
import com.zl.model.entity.User;
import com.zl.service.IUserService;
import com.zl.util.AesCipherUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author zhoulang
 * @date 2018/8/9 15:45
 */
@Service
public class UserServiceImpl extends BaseServiceImpl<UserDto> implements IUserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 修改用户的密码
     * @param id 用户的id
     * @param password 新的密码
     */
    @Override
    public void updatePassword(int id, String password) {
        String newPasswrd = AesCipherUtil.enCrypto(password);
        userMapper.updatePassword(id, newPasswrd);
    }

    @Override
    public UserDto selectByid(Integer userId) {
        return userMapper.selectByid(userId);
    }
}
